import router from './router'
import { getStorageToken } from '@/utils/auth' // get token from cookie

const whiteList = ['/','/login']

router.beforeEach(async(to, from, next) => {
	if(getStorageToken()) {
		next()
	} else {
		if(whiteList.indexOf(to.path) !== -1) {
			next()
		} else {
			next('/login')
		}
	}
})